import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import legacy from "@vitejs/plugin-legacy";
// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  plugins: [
    vue(),
    legacy({
      targets: ["defaults", "not IE 11"],
    }),
  ],
  server: {
    port: 88, // 服务端口号
    open: true, // 服务启动时是否自动打开浏览器
    cors: true, // 允许跨域
    proxy: {
      "/dev-api": {
        // 打包
        // target: "http://192.168.101.20:8082",
        target: "http://1.94.185.57:8082",
        // target: "http://192.168.1.41:8082",
        // target: "http://192.168.101.99:8082",
        // 本地
        // target: "http://192.168.101.100:8082",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/dev-api/, ""), // 此行注释
      },
    },
  },
});
